


var load_info = function(){ return true };
var filter_options = new Object;
var ResultsDataTableDeferred;

/* This var is needed for determine if DataTable should start InitialLoad */
var location_search = location.search;
/* Freebase-suggest options */
var bv_options = {
    soft: true,
    ac_param: {
        type: BIOVENTURIST_DIR + "bv_medical_condition",
        start: 0,
        limit: 30
    }
};










YAHOO.util.Event.addListener(window, "load", function() {
    /* Add Freebase Suggest to filter text-field */
    jQuery("select.filter_type").live("change", function(){
            bv_options['ac_param']['type'] = type_for_freebase_suggest($(this).val());
            $(this).siblings('input.filter_query').freebaseSuggest(bv_options);
        });

    /* Switch a text input to freebase-suggest field at first time */
    bv_options['ac_param']['type']=type_for_freebase_suggest($("select.filter_type").val());
    $("input.filter_query").freebaseSuggest(bv_options);


    var searchPage = new SearchPage();

  
    var table = new Table();
    /* end: Table object */


   
    var filter = new Filter();
    /* end: Filter object */


    /* Bind add filter action to buttons */
    $('input.filter_add').live('click', function(){
        filter.add();
    });

    /* Bind remove filter action to buttons */
    $('input.filter_rm').live('click', function(){
        filter.rm(this);
    });

    /* User clicks on "Filter" button */
    $('input.filter_run').click(function(){
        if (console) {console.log('clicked on search button')};
        filter_options = filter.get_filter_options();        
        filter.apply_to(table);
    });


  

  


});
